import request from '@/common/request.js'
import {InputGradesForm, LearningResourcesForm, LearningResourcesUpdateForm} from "./type";

//上传资源
const uploadResource = (param) => {
    const url = '8185/academicLearning';
    return request.globalRequest(url, 'POST', param, 1)
};

//修改资源
const updateResource = (param) => {
    const url = '8185/academicLearning';
    return request.globalRequest(url, 'PUT', param, 1)
};
//删除资源
const deleteResource = (id) => {
    const url = `8185/academicLearning?id=${id}`;
    return request.globalRequest(url, 'DELETE', {}, 1)
};
//查询资源详情
const getResource = (id) => {
    const url = `8185/academicLearning?id=${id}`;
    return request.globalRequest(url, 'GET', {}, 1)
};

//获取我的资源列表
const getResourceList = () => {
    const url = '8185/academicLearning/list';
    return request.globalRequest(url, 'Get', null, 1)
};

//获取所有资源列表
const getAllResourceList = () => {
    const url = '8185/academicLearning/all';
    return request.globalRequest(url, 'Get', null, 1)
};

//查看某门考试的学生成绩
const getGrade = (courseId) => {
    const url = `8185/academicGrade/score?courseId=${courseId}`;
    return request.globalRequest(url, 'GET', {}, 1)
};


//录入学生成绩
const inputGrades = (param) => {
    const url = '8185/academicGrade/input';
    return request.globalRequest(url, 'PUT', param, 1)
};
//教师所授课程
const teacherGetCourses = () => {
    const url = '8183/course/tea-courses';
    return request.globalRequest(url, 'GET', null, 1)
};
//编辑教师信息
const editTeacher = (data) => {
    const url = '8181/teacher/editTeacher';
    return request.globalRequest(url, 'POST', data, 1)
};
//完善教师信息
const addTeacherFun = (data) => {
    const url = '8181/teacher/addTeacher';
    return request.globalRequest(url, 'POST', data, 1)
};
//考试安排消息发送
const arrangeExamination = (courseId, content) => {
    const url = `8182/message/arrange-examination/${courseId}/${content}`
    return request.globalRequest(url, 'GET', {}, 1)
}

//获取某个课程的学生名单
const courseStudentList = (courseId) => {
    const url = `8182/courseSchedule/stu-list?courseId=${courseId}`
    return request.globalRequest(url, 'GET', {}, 1)
}
export default {
    uploadResource, updateResource, deleteResource, getResource, getResourceList, getAllResourceList,
    getGrade, inputGrades,teacherGetCourses,editTeacher,addTeacherFun,arrangeExamination,
    courseStudentList
};